package org.jeecg.modules.upgrade.service.impl;

import org.jeecg.modules.upgrade.entity.TaskExeFunction;
import org.jeecg.modules.upgrade.entity.TaskExeFunctionParams;
import org.jeecg.modules.upgrade.mapper.TaskExeFunctionParamsMapper;
import org.jeecg.modules.upgrade.mapper.TaskExeFunctionMapper;
import org.jeecg.modules.upgrade.service.ITaskExeFunctionService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 任务方法函数库
 * @author: baochangrong
 * @Date:   2022-12-03
 * @Version: V1.0
 */
@Service
public class TaskExeFunctionServiceImpl extends ServiceImpl<TaskExeFunctionMapper, TaskExeFunction> implements ITaskExeFunctionService {

	@Autowired
	private TaskExeFunctionMapper taskExeFunctionMapper;
	@Autowired
	private TaskExeFunctionParamsMapper taskExeFunctionParamsMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		taskExeFunctionParamsMapper.deleteByMainId(id);
		taskExeFunctionMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			taskExeFunctionParamsMapper.deleteByMainId(id.toString());
			taskExeFunctionMapper.deleteById(id);
		}
	}
	
}
